using EOSDigital.SDK;
using System;
using System.IO;

namespace EOSDigital.API
{
	public class DownloadInfo
	{
		protected IntPtr inRef;

		protected DirectoryItemInfo dirInfo;
		public DirectoryItemInfo ItemInfo
        {
			get { return dirInfo; }
        }

		public IntPtr Reference
		{
			get
			{
				return this.inRef;
			}
		}

		public string FileName
		{
			get
			{
				return this.dirInfo.FileName;
			}
			set
			{
				this.dirInfo.FileName = value;
			}
		}

		public int Size
		{
			get
			{
				return this.dirInfo.Size;
			}
		}

		public long Size64
		{
			get
			{
				return this.dirInfo.Size64;
			}
		}

		public bool IsRAW
		{
			get;
			protected set;
		}

		protected internal DownloadInfo(IntPtr inRef)
		{
			if (inRef == IntPtr.Zero)
			{
				throw new ArgumentNullException("inRef");
			}
			this.inRef = inRef;
			ErrorHandler.CheckError(this, CanonSDK.GetDirectoryItemInfo(inRef, out this.dirInfo));
			string a = Path.GetExtension(this.FileName).ToLower();
			if (a == ".crw" || a == ".cr2")
			{
				this.IsRAW = true;
			}
			else
			{
				this.IsRAW = false;
			}
		}
	}
}
